﻿Public Class FormFactoryOutsourceSave
    Public usr As String
    Public source As String
    Public sys_id As String
    Public assist_marker_jnj As String
    Dim objFactory0utsourceMst As New clsFactory0utsourceMst
    Dim objGt As New clsGt
    Private Sub FormFactoryOutsourceSave_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim dt As DataTable = objFactory0utsourceMst.getList("1", "jnj")
        dgv.AutoGenerateColumns = False
        dgv.DataSource = dt
    End Sub

    Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
        If dgv.SelectedRows.Count > 0 Then
            If String.IsNullOrEmpty(assist_marker_jnj) Then
                Dim rtn As Integer = objGt.update_assist_marker(sys_id, dgv.SelectedRows(0).Cells("Col_name").Value.ToString())
                If rtn <> -2 Then
                    MsgBox("保存成功")
                    If source.Equals("check") Then
                        CType(Owner, FormCheck).setDgvData()
                    End If
                    If source.Equals("6gw") Then
                        CType(Owner, Form6GongWei).setData()
                    End If
                    Close()
                Else
                    MsgBox("保存失败")
                End If
            Else
                If MsgBox("确认要更换胶黏剂厂商吗？", vbYesNo, "提示") = vbYes Then
                    Dim rtn As Integer = objGt.update_assist_marker(sys_id, dgv.SelectedRows(0).Cells("Col_name").Value.ToString())
                    If rtn <> -2 Then
                        MsgBox("保存成功")
                        If source.Equals("check") Then
                            CType(Owner, FormCheck).setDgvData()
                        End If
                        If source.Equals("6gw") Then
                            CType(Owner, Form6GongWei).setData()
                        End If
                        Close()
                    Else
                        MsgBox("保存失败")
                    End If
                End If
            End If
        End If
    End Sub

End Class